﻿@model Model.AppUserList
@{
    ViewBag.Title = "PickBatch";
    Layout = "~/Views/Shared/_JQBaseLayOut.cshtml";
}
@using Model

@section JQscriptSection{
    <script type="text/javascript">
        $(document).ready(function () {
            var curr_time = new Date();
            var strDate = curr_time.getFullYear() + "-";
            strDate += curr_time.getMonth() + 1 + "-";
            strDate += curr_time.getDate();

            var endDate = curr_time.getFullYear() + "-";
            endDate += curr_time.getMonth() + 1 + "-";
            endDate += curr_time.getDate();

            $("#StartDate").datebox("setValue", strDate);
            $("#EndDate").datebox("setValue", endDate);
            InitGrid();

        });


        HandleDom.ClassTriggerClick("icon-edit", function () {
            var rowData = HandleData.GetDataGridSelected("dg");
            if (rowData.FLAG == "1") {
                layer.confirm('请确定是否要禁用？', function (index) {
                    edit(rowData, "0");
                });
            } else {
                layer.confirm('请确定是否要启用？', function (index) {
                    edit(rowData, "1");
                });
            }



        });

        function edit(rowData, flag) {
            $("#hiddenBatchNumber").val(rowData.BATCHNUMBER);
            $("#hiddenBatchDate").val(rowData.BATCHDATE);
            $("#hiddenFlag").val(flag);
            HandleRequest.submitForm('location', '@Url.Action("SaveData", "PickBatch")', function (data) {
                eval('data=' + data);
                if (data.success == true) {
                    layer.alert('执行成功!', 9);
                    InitGrid();
                    HandleDialog.CloseDialog('dlg');
                } else {
                    layer.msg(data.msg, 1);
                }
            });
        }

        function InitGrid() {
            var txtBATCHNUMBER = $('#txtBATCHNUMBER').val();
            var startDate = $('#StartDate').datebox('getValue');
            var endDate = $('#EndDate').datebox('getValue');
            queryParams = {
                batchNumber: txtBATCHNUMBER,
                checkTimeS: startDate,
                checkTimeE: endDate
            }
            HandleData.InitDataGrid('dg', '/PickBatch/InitJsonResult', 'toolbar', queryParams, 'BATCHNUMBER', true, function (data) { },
                function (rowIndex, rowData) {//双击
                    if (rowData.FLAG == "1") {
                        layer.confirm('请确定是否要禁用？', function (index) {
                            edit(rowData, "0");
                        });
                    } else {
                        layer.confirm('请确定是否要启用？', function (index) {
                            edit(rowData, "1");
                        });
                    }
                });
        }
    </script>
}

<body style="background-color: ButtonFace; font-size: 17px">
    <div class="easyui-panel" title="查询条件" style="height: 130px; padding: 5px; background: #fafafa; width: 1700px;">
        <form id="query" method="post">
            <table>
                <tr>
                    <td>订单分拣批次:
                    </td>
                    <td>
                        <input id="txtBATCHNUMBER" name="txtBATCHNUMBER" style="width: 154px" />
                    </td>
                    <td>分拣日期：
                    </td>
                    <td>
                        <input class="easyui-datebox" id="StartDate" name="StartDate" style="width: 140px;" />
                    </td>
                    <td>~：
                    </td>
                    <td>
                        <input class="easyui-datebox" id="EndDate" name="EndDate" style="width: 140px;" validtype="compareDate['#StartDate']" />
                    </td>
                    <td>
                        <a id="btnSerach" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="InitGrid()">查询</a>
                    </td>
                </tr>
            </table>
        </form>
    </div>
    <div style="min-height: 720px; width: 1700px;">
        <table id="dg" title="数据明细" style="min-height: 600px;">
            <thead>
                <tr>
                    <th data-options="field:'BATCHNUMBER',width:30">分拣批次号</th>
                    <th data-options="field:'BATCHDATE',width:100">分拣日期</th>
                    <th data-options="field:'ORDERCOUNT',width:100">订单数</th>
                    <th data-options="field:'PICKTASKCOUNT',width:100">拣货订单数</th>
                    <th data-options="field:'FLAG',width:50,sortable:true,formatter:function(value, rowData, rowIndex){ return FormatData.formatBool(value);}">状态</th>
                </tr>
            </thead>
        </table>
    </div>
    <div>
        <form id="location" method="post">
            <input id="hiddenBatchNumber" name="hiddenBatchNumber" type="hidden" />
            <input id="hiddenBatchDate" name="hiddenBatchDate" type="hidden" />
            <input id="hiddenFlag" name="hiddenFlag" type="hidden" />
        </form>

    </div>


    @Html.Partial("~/Views/Shared/_PartialToolbar.cshtml", new Toolbar
{
    GridName = "dg",
    GridType = "datagrid",
    ToolbarName = "toolbar",
    FunctionModule = new Dictionary<string, List<FunctionModule>>()
    {
        {"Function",new List<FunctionModule>()
            {
              new FunctionModule(){Name = "Add",IsEnable =false },
              new FunctionModule(){Name = "Edit",IsEnable =true },
              new FunctionModule(){Name = "Remove",IsEnable =false },
              new FunctionModule(){Name = "Reload",IsEnable =false },
              new FunctionModule(){Name = "Collapse",IsEnable =false },
              new FunctionModule(){Name = "Exporter",IsEnable =false },
                new FunctionModule(){Name = "IsStatus",IsEnable =false },
              
              
            }
        }
    }
})

</body>



